<%@page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.struts.SessionInfo"%>
<%@page import="com.login.LoginVO;"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
SessionInfo sessionInfo = (SessionInfo)session.getAttribute("sessionInfo");
Map<String, Set<String>> privMap = sessionInfo.getPrivMap();
Set<String> privSet = privMap.keySet();
LoginVO loginvo = sessionInfo.getLoginvo();
String username = loginvo.getUsername();
boolean isAdmin = "admin".equals(username);
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<link href="images/css.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<%=path%>/js/jquery-1.9.1.min.js"></script>
	<SCRIPT LANGUAGE="JavaScript">
		$(function(){
			var currentMenuId = "menu1";
			$("table tr td a").click(clickMenu)
			function clickMenu() {
				var thisId = $(this).parent().parent().parent().parent().attr("id");
				//设置自身菜单为选中菜单
				var selfHtml = '<tr>'
					+'<td width="5"><img src="images/03.gif" width="5" height="28"></td>'
	                +'<td align="center" background="images/008.jpg"><a href="#" class="zi_003">'+$(this).html()+'</a></td>'
	                +'<td width="5"><img src="images/04.gif" width="5" height="28"></td>'
	              +'</tr>';
	            $(this).parent().parent().parent().parent().html(selfHtml);
	            $(this).bind('click', clickMenu);
	            //设置其他菜单为待选状态
	            var preHtml = '<tr>'
	              	+'<td width="6"><img src="images/01.gif" width="6" height="28"></td>'
	              	+'<td align="center" background="images/005.jpg"><a href="#" class="zi_002">'+$('#'+currentMenuId+' tr td a').html()+'</a></td>'
	              	+'<td width="6"><img src="images/02.gif" width="6" height="28"></td>'
	              +'</tr>';
	            $('#'+currentMenuId).html(preHtml);
	            $('#'+currentMenuId+' tr td a').bind('click', clickMenu);
	            //将自身设置为当前菜单
				currentMenuId = thisId;
				if (currentMenuId=='menu1') {//首页
					var submenuHmtl = '';
					$('#submenu').html(submenuHmtl);
					self.parent.document.getElementById("rightframe").src = "<%=basePath%>/welcome.html";
				} else if (currentMenuId=='menu2') {//信息录入
					var submenuHmtl = "";
					<%Set s2 = privMap.get("inputmessage"); %>
					<%if(isAdmin || s2 != null && s2.contains("inputmessageright")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/inputmessage/inputmessageright.jsp\");'>车辆信息采集</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s2 != null && s2.contains("inputmessageright_driver")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/inputmessage/inputmessageright_driver.jsp\");'>驾驶证信息采集</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s2 != null && s2.contains("inputmessageright_bussi")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/inputmessage/inputmessageright_bussi.jsp\");'>营运车捆绑录入</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s2 != null && s2.contains("inputmessageright_school")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/inputmessage/inputmessageright_school.jsp\");'>校车捆绑录入</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s2 != null && s2.contains("inputmessageright_taxi")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/inputmessage/inputmessageright_taxi.jsp\");'>出租车捆绑录入</a>&nbsp;&nbsp;";
					<%} %>
					$('#submenu').html(submenuHmtl);
					$('#submenu').children()[0].click();
				} else if (currentMenuId=='menu3') {
					var submenuHmtl = "";
					<%Set s3 = privMap.get("messager"); %>
					<%if(isAdmin || s3 != null && s3.contains("messagerCenterright")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/messager/messagerCenterright.jsp\");'>信息员录入</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s3 != null && s3.contains("messagerCenterQuery")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/messager/messagerCenterQuery.jsp\");'>信息员查询</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s3 != null && s3.contains("messagerCenterMod")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/messager/messagerCenterMod.jsp\");'>信息员修改</a>&nbsp;&nbsp;";
					<%} %>
					$('#submenu').html(submenuHmtl);
					$('#submenu').children()[0].click();
				} else if (currentMenuId=='menu4') {
					var submenuHmtl = "";
					<%Set s4 = privMap.get("query"); %>
					<%if(isAdmin || s4 != null && s4.contains("queryCenterright")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/query/queryCenterright.jsp\");'>车辆查询</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s4 != null && s4.contains("queryCenterDriver")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/query/queryCenterDriver.jsp\");'>驾驶人查询</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s4 != null && s4.contains("queryCenterMsgPerson")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/query/queryCenterMsgPerson.jsp\");'>信息员查询</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s4 != null && s4.contains("queryCenterTx")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/query/queryCenterTx.jsp\");'>通讯录查询</a>&nbsp;&nbsp;";
					<%} %>
					<%if(isAdmin || s4 != null && s4.contains("queryCenterMsgPersonAll")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/query/queryCenterMsgAll.jsp\");'>信息员全部查询</a>&nbsp;&nbsp;";
					<%} %>
					$('#submenu').html(submenuHmtl);
					$('#submenu').children()[0].click();
				} else if (currentMenuId=='menu5') {
				    var submenuHmtl = "";
				    <%Set s5 = privMap.get("servicecenter"); %>
				    <%if(isAdmin || s5 != null && s5.contains("queryPendingList")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=path%>/servicecenter/queryPendingList.action\");'>待办信息</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s5 != null && s5.contains("queryMakingList")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=path%>/servicecenter/queryMakingList.action\");'>办结信息</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s5 != null && s5.contains("queryPassOnList")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=path%>/servicecenter/queryPassOnList.action\");'>转办信息</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s5 != null && s5.contains("serviceCenterright-qqbz")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=path%>/servicecenter/enterHelp.action\");'>申请帮助</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s5 != null && s5.contains("queryCreateList")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=path%>/servicecenter/queryCreateList.action\");'>服务评价</a>&nbsp;&nbsp;";
					<%} %>
					$('#submenu').html(submenuHmtl);
					$('#submenu').children()[0].click();
				} else if (currentMenuId=='menu6') {
				    var submenuHmtl = "";
				    <%Set s6 = privMap.get("file"); %>
				    <%if(isAdmin || s6 !=null && s6.contains("uploadfileinfo")){ %>
						submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/filemanage/uploadfileinfo.action\");'>上传文件</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s6 !=null && s6.contains("getNoReadFiles")){ %>
						submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/filemanage/getNoReadFiles.action\");'>待阅文件</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s6 !=null && s6.contains("getReadedFiles")){ %>
						submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/filemanage/getReadedFiles.action\");'>已阅文件</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s6 !=null && s6.contains("turnfile")){ %>
						submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/filemanage/getTurnFiles.action\");'>转发文件</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s6 !=null && s6.contains("endfile")){ %>
						submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/filemanage/getEndsFiles.action\");'>落实文件</a>&nbsp;&nbsp;";
					<%} %>
					$('#submenu').html(submenuHmtl);
					$('#submenu').children()[0].click();
				} else if (currentMenuId=='menu7') {
					var submenuHmtl = '<p></p>';
					$('#submenu').html(submenuHmtl);
					$('#submenu').children()[0].click();
				} else if (currentMenuId=='menu8') {
					var submenuHmtl = '<p></p>';
					$('#submenu').html(submenuHmtl);
					$('#submenu').children()[0].click();
				} else if (currentMenuId=='menu9') {
				    var submenuHmtl = "";
					<%Set s9 = privMap.get("notice"); %>
				    <%if(isAdmin || s9 !=null && s9.contains("noticeCenterright")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>manage/notice/noticeCenterright.jsp\");'>导入</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s9 !=null && s9.contains("noticeCenterQuery")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>manage/notice/noticeCenterQuery.jsp\");'>查询</a>&nbsp;&nbsp;";
					<%} %>
					$('#submenu').html(submenuHmtl);
					$('#submenu').children()[0].click();
				} else if (currentMenuId=='menu10') {
					var submenuHmtl ='<p></p>';
					$('#submenu').html(submenuHmtl);
					self.parent.document.getElementById("rightframe").src = "<%=basePath%>//manage/report/report_query.jsp";
				} else if (currentMenuId=='menu11') {
				    var submenuHmtl = "";
					<%Set s11 = privMap.get("grouppriv"); %>
				    <%if(isAdmin || s11 !=null && s11.contains("findAllGroup")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/group/findAllGroup.action\");'>分组列表</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s11 !=null && s11.contains("addgroup")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/grouppriv/addgroup.jsp\");'>新增分组</a>&nbsp;&nbsp;";
					<%}if(isAdmin || s11 !=null && s11.contains("dicManage")){ %>
					submenuHmtl += "<a class=\"zi_004\" href='javascript:choiceSubMenu(\"<%=basePath%>/manage/grouppriv/dicmanage/diclist.jsp\");'>信息维护</a>";
					<%} %>
					$('#submenu').html(submenuHmtl);
					$('#submenu').children()[0].click();
				}
			}
		});
		function choiceSubMenu(righturl) {
			self.parent.document.getElementById("rightframe").src = righturl;
		}
		function logout(){
			 $.ajax({
		    	type: "POST",
		    	url: "<%=path %>/system/logout.action",
		    	data: "",
		    	dataType:"text", //ajax返回值设置为text（json格式也可用它返回，可打印出结果，也可设置成json）
		    	success: function(json){  
		    		var obj = $.parseJSON(json);  //使用这个方法解析json
		            var state = obj.ajaxResult;  //result是和action中定义的result变量的get方法对应的
		            if(state == "done"){
		            	self.parent.location.href="<%=path %>/login.jsp";
		            }
		            else{
		            	return false;
		            }
		    	},
		    	error: function(json){
		     		return false;
		    	}
		    });
		}
	</SCRIPT>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="145" align="center" valign="top" class="bg_001"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="2" align="right" class="zi_001">&nbsp;</td>
        </tr>
      <tr>
        <td height="30" align="right" class="zi_001">服务等级 ★★★    <a href="#" class="zi_001" href="#" onclick="return logout()">退出</a></td>
        <td width="50">&nbsp;</td>
      </tr>
      <tr>
        <td align="right" class="zi_001"><table width="230" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="right"><img src="images/002.jpg" width="68" height="67"></td>
            <td align="right"><img src="images/003.jpg" width="69" height="67"></td>
            <td align="right"><img src="images/004.jpg" width="68" height="67"></td>
          </tr>
        </table></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="8" colspan="2" align="right" class="zi_001"></td>
        </tr>
      
    </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>&nbsp;</td>
          <td width="82" align="center">
	          <table id= "menu1" width="100%" border="0" cellspacing="0" cellpadding="0">
	            <tr>
	              <td width="5"><img src="images/03.gif" width="5" height="28"></td>
	              <td align="center" background="images/008.jpg"><a href="#" class="zi_003">首  页</a></td>
	              <td width="5"><img src="images/04.gif" width="5" height="28"></td>
	            </tr>
	          </table>
	      </td>
	      <%
          if(isAdmin || privSet.contains("inputmessage")){
	      %>
          <td width="82" align="center">
          	<table id= "menu2" width="100%" border="0" cellspacing="0" cellpadding="0">
	            <tr>
	              <td width="6"><img src="images/01.gif" width="6" height="28"></td>
	              <td align="center" background="images/005.jpg"><a href="#" class="zi_002">信息录入</a></td>
	              <td width="6"><img src="images/02.gif" width="6" height="28"></td>
	            </tr>
            </table>
          </td>
          <%} 
          if(isAdmin || privSet.contains("messager")){
	      %>
          <td width="82" align="center">
          	<table id= "menu3" width="100%" border="0" cellspacing="0" cellpadding="0">
            	<tr>
              		<td width="6"><img src="images/01.gif" width="6" height="28"></td>
              		<td align="center" background="images/005.jpg"><a href="#"class="zi_002">信息员管理</a></td>
              		<td width="6"><img src="images/02.gif" width="6" height="28"></td>
            	</tr>
          	</table>
          </td>
          <%} 
          if(isAdmin || privSet.contains("query")){
	      %>
          <td width="82" align="center">
          	<table id= "menu4" width="100%" border="0" cellspacing="0" cellpadding="0">
            	<tr>
              		<td width="6"><img src="images/01.gif" width="6" height="28"></td>
              		<td align="center" background="images/005.jpg"><a href="#" class="zi_002">综合查询</a></td>
              		<td width="6"><img src="images/02.gif" width="6" height="28"></td>
            	</tr>
          	</table>
          </td>
          <%}
          if(isAdmin || privSet.contains("servicecenter")){
    	  %>
          <td width="82" align="center">
          	<table id= "menu5" width="100%" border="0" cellspacing="0" cellpadding="0">
            	<tr>
              		<td width="6"><img src="images/01.gif" width="6" height="28"></td>
              		<td align="center" background="images/005.jpg"><a href="#" class="zi_002">服务中心</a></td>
              		<td width="6"><img src="images/02.gif" width="6" height="28"></td>
            	</tr>
          	</table>
          </td>
          <%}
          if(isAdmin || privSet.contains("file")){
          %>
          <td width="82" align="center">
            <table id= "menu6" width="100%" border="0" cellspacing="0" cellpadding="0">
            	<tr>
              		<td width="6"><img src="images/01.gif" width="6" height="28"></td>
              		<td align="center" background="images/005.jpg"><a href="#" class="zi_002">文件管理</a></td>
              		<td width="6"><img src="images/02.gif" width="6" height="28"></td>
            	</tr>
          	</table>
          </td>
          <%}
          if(isAdmin || privSet.contains("innermail")){
          %>
          <td width="82" align="center">
          	<table id= "menu7" width="100%" border="0" cellspacing="0" cellpadding="0">
            	<tr>
              		<td width="6"><img src="images/01.gif" width="6" height="28"></td>
              		<td align="center" background="images/005.jpg"><a href="#" class="zi_002">站内信箱</a></td>
              		<td width="6"><img src="images/02.gif" width="6" height="28"></td>
            	</tr>
          	</table>
          </td>
          <%} 
          if(isAdmin || privSet.contains("sms")){
          %>
          <td width="82" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          	<table id= "menu8" width="100%" border="0" cellspacing="0" cellpadding="0">
            	<tr>
              		<td width="6"><img src="images/01.gif" width="6" height="28"></td>
              		<td align="center" background="images/005.jpg"><a href="#" class="zi_002">短信平台</a></td>
              		<td width="6"><img src="images/02.gif" width="6" height="28"></td>
            	</tr>
          	</table>  
          </td>
          <%} 
          if(isAdmin || privSet.contains("notice")){
          %>
          <td width="82" align="center">
           <table id= "menu9" width="100%" border="0" cellspacing="0" cellpadding="0">
            	<tr>
              		<td width="6"><img src="images/01.gif" width="6" height="28"></td>
              		<td align="center" background="images/005.jpg"><a href="#" class="zi_002">违法告知</a></td>
              		<td width="6"><img src="images/02.gif" width="6" height="28"></td>
            	</tr>
          	</table>
          </td>
          <%} 
          if(isAdmin || privSet.contains("report")){
          %>
          <td width="82" align="center">
            <table id= "menu10" width="100%" border="0" cellspacing="0" cellpadding="0">
            	<tr>
              		<td width="6"><img src="images/01.gif" width="6" height="28"></td>
              		<td align="center" background="images/005.jpg"><a href="#" class="zi_002">举报受理</a></td>
              		<td width="6"><img src="images/02.gif" width="6" height="28"></td>
            	</tr>
          	</table>
          </td>
          <%} 
          if(isAdmin || privSet.contains("grouppriv")){
          %>
          <td width="82" align="center">
            <table id= "menu11" width="100%" border="0" cellspacing="0" cellpadding="0">
            	<tr>
              		<td width="6"><img src="images/01.gif" width="6" height="28"></td>
              		<td align="center" background="images/005.jpg"><a href="#" class="zi_002">权限分组</a></td>
              		<td width="6"><img src="images/02.gif" width="6" height="28"></td>
            	</tr>
          	</table>
          </td>
          <%} %>
          <td width="5" height="28"></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="28" align="right" background="<%=basePath%>/images/009.jpg">
    <table width="50%" border="0" cellspacing="0" cellpadding="0">
      <tr>
      	<td align="left" id="submenu"></td>
      </tr>
    </table>
    </td>
  </tr>
</table>
</body>
</html>
